package jj.jjstudy.service.impl;

import jj.jjstudy.dao.UserMapper;
import jj.jjstudy.entity.User;
import jj.jjstudy.response.JsonData;
import jj.jjstudy.response.ResponseData;
import jj.jjstudy.service.UserService;
import jj.jjstudy.utils.UuidUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class UserServiceImpl  implements UserService {


    @Autowired
    private UserMapper userMapper;

    @Override
    public ResponseData inserUser(User user) {

        try {
            user.setUser_id(UuidUtils.getUUId());
            Integer res = userMapper.inserUser(user);
            if (! (res > 0) ){
                return JsonData.fail("新增失败");
            }
        }catch (Exception e){

            return JsonData.fail("系统异常");
        }
        return JsonData.success();
    }
}
